﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TDSManagement.aspx.cs" Inherits="Main_ServiceInvoice_TDSManagement"
    Culture="en-GB" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>TDS Management</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/Tab/StyleSheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    
   	   	 .ajax__tab_technorati-theme .ajax__tab_hover .ajax__tab_outer
        {
            cursor: pointer;
        }
        .ajax__tab_technorati-theme .ajax__tab_hover .ajax__tab_inner
        {
            cursor: pointer;
        }
        .ajax__tab_technorati-theme .ajax__tab_hover .ajax__tab_tab
        {
            cursor: pointer;
        }

</style>
  

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="divmain" style="width: 96%; margin-left: 2%;">
        <asp:HiddenField ID="hidControlCounter" runat="server" Value="1" />
        <asp:HiddenField ID="hidDate" runat="server" />
        <asp:HiddenField ID="hidVoucherTranID" runat="server" />
        <asp:HiddenField ID="hidTotalAmount" runat="server" />
        <acc:heading ID="pagehead" runat="server" HeadingText="TDS Management" />
        <div style="margin-left: 5%; margin-right: 3%; width: 85%" align="center">
            <asp:Label ID="lblMsg" runat="server" Font-Bold="True"></asp:Label>
        </div>
    </div>
    
    <ajaxToolkit:TabContainer id="Tabs" runat="server" cssclass="ajax__tab_technorati-theme" onactivetabchanged="Tabs_ActiveTabChanged" autopostback="false">
    <ajaxToolkit:TabPanel id="tabpanel1" runat="server" HeaderText="New" >
        <ContentTemplate>
                    <table style="width: 96%; margin-left: 1%; margin-top: 10px;" class="tablecontent" cellpadding="3" cellspacing="2">
                        <tr>
                            <td>
                                <b>TDS No.</b><span style="color: Red;">*</span>
                            </td>
                            <td>
                                <asp:TextBox ID="TxtTdsNo" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                            </td>
                            <td>
                                <b>Ref No.</b>
                            </td>
                            <td>
                                <asp:TextBox ID="TxtRefNo" runat="server" CssClass="inputnumber"></asp:TextBox>
                            </td>
                            <td>
                                <b>Date</b>
                            </td>
                            <td>
                                <asp:TextBox ID="TxtDate" runat="server" CssClass="input" OnKeyDown="EnableTabKey(this.id,this.event);"
                                    OnTextChanged="TxtDate_TextChanged"></asp:TextBox>
                                <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                                <ajaxToolkit:calendarextender id="cal" runat="server" popupbuttonid="btnDate" targetcontrolid="txtdate"
                                    format="dd/MM/yyyy" enabled="True">
                                </ajaxToolkit:calendarextender>
                                <ajaxToolkit:maskededitextender id="maskExt" runat="server" masktype="Date" mask="99/99/9999"
                                    targetcontrolid="txtdate" culturename="pt-BR" cultureampmplaceholder="" culturecurrencysymbolplaceholder="R$"
                                    culturedateformat="DMY" culturedateplaceholder="/" culturedecimalplaceholder=","
                                    culturethousandsplaceholder="." culturetimeplaceholder=":" enabled="True">
                                </ajaxToolkit:maskededitextender>
                                <ajaxToolkit:maskededitvalidator id="maskValid" runat="server" controlextender="maskExt"
                                    invalidvaluemessage="Invalid Date" display="Dynamic" validationgroup="V" controltovalidate="txtdate"
                                    errormessage="maskValid"></ajaxToolkit:maskededitvalidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <b>Customer</b><span style="color: Red;">*</span>
                            </td>
                            <td colspan="6">
                                <asp:DropDownList ID="ddlCustomer" runat="server" CssClass="dropdown" AutoPostBack="True"
                                    OnSelectedIndexChanged="ddlCustomer_SelectedIndexChanged" Width="95%">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                    <div class="divmain" style="width: 96%; margin-left: 1%; margin-top: 10px; margin-bottom: 10px;">
                        <b>Bill/Debit Note Details</b>
                    </div>
                    <div style="overflow: scroll;width: 96%; margin-left: 1%; margin-top: 5px;" class="tablecontent">
                        <table style="width: 100%; height:100%; vertical-align:top;" id="tblParticularService" runat="server">
                            <tr>
                                <td align="center" class="headtd">
                                    <b>Particulars</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Service</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Balance Amount</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>TDS Amount</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>ST Rate(%)</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>PE Cess Rate(%)</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>HE Cess Rate(%)</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Service Tax</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>P.E.Cess</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>H.E.Cess</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Certificate No.</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Received Date</b>
                                </td>
                                <td align="center" class="headtd">
                                    <b>Remarks</b>
                                </td>
                            </tr>
                            <tr style="margin-top:10px;">
                                <td>
                                    <asp:DropDownList ID="ddlparticular1" runat="server" AutoPostBack="True" CssClass="dropdown"
                                        OnSelectedIndexChanged="ddlparticular_SelectedIndexChanged">
                                    </asp:DropDownList>
                                    <asp:HiddenField ID="hidReferenceId1" runat="server" />
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlservice1" runat="server" AutoPostBack="True" CssClass="dropdown"
                                        Onchange="checkItemRepetion(this.id);" OnSelectedIndexChanged="ddlservice_SelectedIndexChanged">
                                    </asp:DropDownList>
                                    <asp:HiddenField ID="hidRefTranId1" runat="server" />
                                    <asp:HiddenField ID="hidRefChildId1" runat="server" />
                                    <input type="hidden" id="hidAddDesc1" runat="server" />
                                </td>
                                <td>
                                   <asp:TextBox ID="txtnewbalamount1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewtdsamount1" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.id, event); checkserviceselect(this.id);"
                                        onblur="calculate(); calculateTotalAmount(); " Text="0.00"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewstrate1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewpecessrate1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewhecessrate1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewservicetax1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewpecess1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewhecess1" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewcertificateno1" runat="server" CssClass="inputnumber"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewreceiveddate1" runat="server" CssClass="input" OnKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>
                                    <ajaxToolkit:calendarextender id="calReceivedDate1" runat="server" popupbuttonid="txtnewreceiveddate1"
                                        targetcontrolid="txtnewreceiveddate1" format="dd/MM/yyyy" enabled="True">
                                    </ajaxToolkit:calendarextender>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtnewremarks1" runat="server" CssClass="input"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                        <table style="width: 98%; margin-top: 10px; margin-bottom: 10px;" align="right">
                            <tr>
                                <td>
                                    <asp:LinkButton ID="btnAddMore" runat="server" OnClick="btnAddMore_Click"> 
                                        <img src="../../Images/More.jpg" alt="Add New Row" />
                                    </asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                        <br />
                        <br />
                        <table style="width: 70%; margin-top: 10px; margin-bottom: 2px; margin-left: 30%;" align="center">
                            <tr>
                                <td style="width: 70%;">
                                    <span style="padding-right: 70px">Total_Amount&nbsp;&nbsp;<asp:TextBox ID="txtTotalAmount" runat="server"
                                        Enabled="false" Width="30%"></asp:TextBox></span>
                                    <asp:Button ID="btn_save" runat="server" Text="Save" CssClass="button" OnClientClick="return checkParticularService2();"
                                        OnClick="btn_save_Click" />
                                    <asp:Button ID="btn_cancel" runat="server" Text="Cancel" CssClass="button" OnClick="btn_cancel_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
        </ContentTemplate>
    </ajaxToolkit:TabPanel>

    <ajaxToolkit:TabPanel id="tabpanel2" runat="server" HeaderText="Receipt/CreditNote">
      <ContentTemplate>
                    <table cellpadding="5" cellspacing="5" style="width: 96%; margin-left: 1%; margin-top: 10px;" class="tablecontent">
                        <tr>
                            <td>
                                <b>TDS No.</b><span style="color: Red;">*</span>
                            </td>
                            <td>
                                <asp:TextBox ID="Txtrectdsno" runat="server" CssClass="inputnumber" Enabled="false"></asp:TextBox>
                            </td>
                            <td>
                                <b>Ref No.</b>
                            </td>
                            <td>
                                <asp:TextBox ID="txtrecrefno" runat="server" CssClass="inputnumber"></asp:TextBox>
                            </td>
                            <td>
                                <b>Date</b>
                            </td>
                            <td>
                                <asp:TextBox ID="txtrecdate" runat="server" CssClass="input" Enabled="false"></asp:TextBox>
                                <asp:ImageButton ID="btnrecDate" runat="server" ImageUrl="~/Images/calendar.gif"
                                    meta:resourcekey="btnrecDateResource1" />
                                <ajaxToolkit:calendarextender id="calrec" runat="server" popupbuttonid="btnrecDate"
                                    targetcontrolid="txtrecdate" format="dd/MM/yyyy" enabled="True">
                                </ajaxToolkit:calendarextender>
                                <ajaxToolkit:maskededitextender id="maskExtrec" runat="server" masktype="Date" mask="99/99/9999"
                                    targetcontrolid="txtrecdate" culturename="pt-BR" cultureampmplaceholder="" culturecurrencysymbolplaceholder="R$"
                                    culturedateformat="DMY" culturedateplaceholder="/" culturedecimalplaceholder=","
                                    culturethousandsplaceholder="." culturetimeplaceholder=":" enabled="True">
                                </ajaxToolkit:maskededitextender>
                                <ajaxToolkit:maskededitvalidator id="maskValidrec" runat="server" controlextender="maskExtrec"
                                    invalidvaluemessage="Invalid Date" display="Dynamic" validationgroup="V" controltovalidate="txtrecdate"
                                    errormessage="maskValidrec" meta:resourcekey="maskValidrecResource1"></ajaxToolkit:maskededitvalidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <b>Customer</b><span style="color: Red;">*</span>
                            </td>
                            <td colspan="6">
                                <asp:DropDownList ID="ddlreccustomer" runat="server" CssClass="dropdown" onchange="javascript:__doPostBack('this.id','')" AutoPostBack="True"
                                    OnSelectedIndexChanged="ddlreccustomer_SelectedIndexChanged" Width="95%">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                    <div style="overflow: scroll; width: 96%; margin-left: 1%; margin-top: 5px;" class="tablecontent">
                        <asp:GridView ID="grdDetailExistingTDS" runat="server" CssClass="gridview" AutoGenerateColumns="False"
                            CellPadding="5" AlternatingRowStyle-CssClass="gridview_alternate" Width="100%">
                            <Columns>
                                <asp:BoundField HeaderText="Particulars" DataField="particulars" ItemStyle-Wrap="false"
                                    HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="Services" DataField="Service" ItemStyle-Wrap="false"
                                    HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="TDS Amount" DataField="TDS Amount" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ST Rate" DataField="STRate" ItemStyle-Wrap="false" ItemStyle-Width="75px"
                                    HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="PECess Rate" DataField="Cess1Rate" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="HECess Rate" DataField="Cess2Rate" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ST Amount" DataField="ServiceAmt" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="PECess Amount" DataField="Cess1Amt" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="HECess Amount" DataField="Cess2Amt" ItemStyle-Wrap="false"
                                    ItemStyle-Width="75px" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False" Width="75px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="Certificate Number" DataField="CertificateNumber" ItemStyle-Wrap="false"
                                    HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="Received Date" DataField="receiveddate" ItemStyle-Wrap="false"
                                    HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField HeaderText="Remarks" DataField="remarks" ItemStyle-Wrap="false" HeaderStyle-Wrap="false">
                                    <HeaderStyle Wrap="False"></HeaderStyle>
                                    <ItemStyle Wrap="False"></ItemStyle>
                                </asp:BoundField>
                            </Columns>
                            <HeaderStyle Width="125px" />
                            <AlternatingRowStyle CssClass="gridview_alternate"></AlternatingRowStyle>
                            <EmptyDataTemplate>
                            <center><span style="font-weight:bold; color:Red;">Record not found !</span></center>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
      </ContentTemplate>
    </ajaxToolkit:TabPanel>
    </ajaxToolkit:TabContainer>
    </form>
      <script language="javascript" type="text/javascript">
          function isNumberKey(control_id, evt) {
              var charCode = (evt.which) ? evt.which : event.keyCode
              if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 45 || charCode > 47))
                  return false;

              if (charCode == 46) {
                  var dotcount = document.getElementById(control_id).value.split('.').length - 1;
                  if (dotcount >= 1) {
                      return false;
                  }
              }
              return true;
          }

          function checkItemRepetion(id) {
              var flag = new Boolean(true);
              var ddl = document.getElementById(id);
              var currentValue = ddl.options[ddl.selectedIndex].value;
              var Count = document.getElementById("hidControlCounter").value;
              for (var i = 1; i <= Count; i++) {
                  var service = "Tabs_tabpanel1_ddlservice" + i;
                  var previous = document.getElementById(service);
                  if (previous != null) {
                      var previousValue = previous.options[previous.selectedIndex].value;
                      if (ddl != previous) {
                          if (currentValue == previousValue) {
                              alert('Please Select Unique Service Name !');
                              ddl.selectedIndex = 0;
                              flag = false;
                              break;
                          }
                      }
                  }
                  if (flag == true) {
                      setTimeout('__doPostBack(\'' + id + '\',\'\')', 0);
                  }
              }
              return flag;
          }
          function checkBalanceTDSAmount() {
              var Count = (document.getElementById("hidControlCounter").value);
              for (var i = 1; i <= Count; i++) {
                  var txtBalAmt = parseFloat(document.getElementById("Tabs_tabpanel1_txtnewbalamount" + i).value);
                  var txtTdsAmt = parseFloat(document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).value);
                  if (txtBalAmt < txtTdsAmt) {
                      alert('TDS amount should not exeed balance amount !');
                      document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).focus();
                      break;
                  }
              }

          }
          function calculate() {
              var Count = document.getElementById("hidControlCounter").value;
              for (var i = 1; i <= Count; i++) {
                  var StAmt = 0;
                  var txtBalAmt = document.getElementById("Tabs_tabpanel1_txtnewbalamount" + i).value;
                  var txtTdsAmt = document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).value;
                  var StRate = document.getElementById("Tabs_tabpanel1_txtnewstrate" + i).value;
                  var PECessRate = document.getElementById("Tabs_tabpanel1_txtnewpecessrate" + i).value;
                  var HECessRate = document.getElementById("Tabs_tabpanel1_txtnewhecessrate" + i).value;
                  var taxability = document.getElementById("Tabs_tabpanel1_hidAddDesc" + i).value;

                  if (txtTdsAmt == '') {
                      txtTdsAmt = '0';
                  }
                  if (StRate == '') {
                      StRate = '0';
                  }
                  if (PECessRate == '') {
                      PECessRate = '0';
                  }
                  if (HECessRate == '') {
                      HECessRate = '0';
                  }
                  if (txtBalAmt != '0' && txtBalAmt != '') {
                      if (parseFloat(txtTdsAmt) > parseFloat(txtBalAmt)) {
                          alert('TDS Amount Can Not be greater than ' + parseFloat(txtBalAmt).toFixed(2));
                          document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).value = parseFloat(txtBalAmt).toFixed(2);
                          txtTdsAmt = txtBalAmt;
                      }
                      if (taxability == '0') {
                          StAmt = (parseFloat(txtTdsAmt) * parseFloat(StRate)) / 100;
                          document.getElementById("Tabs_tabpanel1_txtnewservicetax" + i).value = StAmt.toFixed(2);
                          document.getElementById("Tabs_tabpanel1_txtnewpecess" + i).value = ((parseFloat(StAmt) * parseFloat(PECessRate)) / 100).toFixed(2);
                          document.getElementById("Tabs_tabpanel1_txtnewhecess" + i).value = ((parseFloat(StAmt) * parseFloat(HECessRate)) / 100).toFixed(2);
                      }
                      else {
                          document.getElementById("Tabs_tabpanel1_txtnewservicetax" + i).value = "0.00";
                          document.getElementById("Tabs_tabpanel1_txtnewpecess" + i).value = "0.00";
                          document.getElementById("Tabs_tabpanel1_txtnewhecess" + i).value = "0.00";
                      }
                  }

              }
          }

          function calculateTotalAmount() {
              var tdsamount = parseFloat("0.00");
              var count = document.getElementById("hidControlCounter").value;
              for (var d = 1; d <= count; d++) {
                  if (document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + d).value != "") {
                      var amount = parseFloat(document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + d).value);
                      tdsamount = (parseFloat(tdsamount) + parseFloat(amount));
                  }
              }
              document.getElementById('<%=hidTotalAmount.ClientID %>').value = tdsamount.toFixed(2);
              document.getElementById("Tabs_tabpanel1_txtTotalAmount").value = tdsamount.toFixed(2).toString();
          }

          function checkserviceselect(id) {
              var str = id.toString();
              var result = str.substr(15, 16);
              var service = document.getElementById("Tabs_tabpanel1_ddlservice" + result).value;
              var particular = document.getElementById("Tabs_tabpanel1_ddlparticular" + result).value;
              if (particular == '0' || particular == '') {
                  alert('Please select particular !');
                  document.getElementById("Tabs_tabpanel1_ddlparticular" + result).focus();
              }
              else if (service == '0' || service == '-Select-') {
                  alert('Please select service !');
                  document.getElementById("Tabs_tabpanel1_ddlservice" + result).focus();
              }
          }
          function checkParticularService2() {
              var customer = document.getElementById("ddlCustomer").value;
              if (customer == '0' || customer == '') {
                  alert('Please select customer !');
                  document.getElementById("ddlCustomer").focus();
                  return false;
              }
              var count = document.getElementById("hidControlCounter").value;
              for (var i = 1; i <= count; i++) {
                  var service = document.getElementById("Tabs_tabpanel1_ddlservice" + i).value;
                  var particular = document.getElementById("Tabs_tabpanel1_ddlparticular" + i).value;
                  var tds = document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).value;
                  if (particular == '0' || particular == '') {
                      alert('Please select particular !');
                      document.getElementById("Tabs_tabpanel1_ddlparticular" + i).focus();
                      return false;
                      break;
                  }
                  else if (service == '0' || service == '-Select-') {
                      alert('Please select service !');
                      document.getElementById("Tabs_tabpanel1_ddlservice" + i).focus();
                      return false;
                      break;
                  }
                  else if (tds <= 0 || tds == '') {
                      alert('Please enter TDS amount !');
                      document.getElementById("Tabs_tabpanel1_txtnewtdsamount" + i).focus();
                      return false;
                      break;
                  }
              }

              return true;
          }
          function EnabledTabKey(id, e) {
              var keycode;
              if (window.event) {
                  keycode = window.event.keyCode;
              }
              else if (e) {
                  keycode = e.which;
              }
              else {
                  return true;
              }

              if (keycode == 9) {
                  // if is the tab key                
                  return true;
              }
              else {
                  return false;
              }
          }
      
    </script>
</body>
</html>
